home *** CD-ROM | disk | FTP | other *** search
/ Computer Select (Limited Edition) / Computer Select.iso / dobbs / v16n10 / string.exe / STRIFUNC.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-30  |  391 b   |  18 lines

  1. #include <string.h>
  2. #include <ctype.h>
  3. #include <errno.h>
  4. #include <string.hpp>
  5.  
  6. String String::operator()(int start, int len)
  7. {
  8.     if (len < 0 || start < 0 || start >= length()) {
  9.         errno = ERANGE;
  10.         String t;
  11.         return t;
  12.     } else {
  13.         if (length()-start < len) len = length()-start;
  14.         String t(body()+start, len);
  15.         return t;
  16.     }
  17. }
  18.